﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BO;

namespace ProjectQuaDep.Admin
{
    public partial class cachedemo : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            chatDemo();
        }
        public void chatDemo()
        {
            object cache = BO.CacheUtil.getCache("cuahang1khach1");
            if (cache == null)
            {
                string chat = "Cửa hàng 1:" + TextBox1.Text.Trim() + "</br>";
                cache += "-" + chat;
                BO.CacheUtil.Add("cuahang1khach1", cache, 3);
                lblChat.Text = cache.ToString();
            }
            else
            {
                string chat = "Cửa hàng 1:" + TextBox1.Text.Trim() + "</br>";
                cache += "-" + chat;
                BO.CacheUtil.Add("cuahang1khach1", cache, 3);
                lblChat.Text = cache.ToString();
            }
        }
        public void chatDemo2()
        {
            object cache = BO.CacheUtil.getCache("cuahang1khach1");
            if (cache == null)
            {
                string chat = "-" + "Khách 1:" + TextBox2.Text.Trim() + "</br>";
                cache +=  chat;
                BO.CacheUtil.Add("cuahang1khach1", cache, 3);
                lblChat.Text = cache.ToString();
            }
            else
            {
                string chat = "-" + "Khách 1:" + TextBox2.Text.Trim() + "</br>";
                cache += "-" + chat;
                BO.CacheUtil.Add("cuahang1khach1", cache, 3);
                lblChat.Text = cache.ToString();
            }
        }

        protected void Button2_Click(object sender, EventArgs e)
        {
            chatDemo2();
        }
    }
}